<!DOCTYPE html>
<html class="x-admin-sm">

<head>
    <meta charset="UTF-8">
    <title>修改赛事</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
        content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="stylesheet" href="../css/font.css">
    <link rel="stylesheet" href="../css/xadmin.css">
    <script type="text/javascript" src="../lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="../js/xadmin.js"></script>
    <script src="../js/base.js"></script>
    <script src="../js/jquery.min.js"></script>
    <script src="../js/area.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        .title .pull-left {
            float: left;
            font-size: 18px;
            font-weight: 700;
            color: #b1b1b1;
            line-height: 42px;
        }

        .title .pull-left.active {
            color: #333;
            border-bottom: 1px solid #42abff;
        }

        .title .pull-left.active .num {
            font-size: 33px;
            color: #3385c6;
        }

        .title .pull-left .num {
            font-size: 33px;
        }

        .chooseType div,
        .chooseType input {
            margin-top: 0;
            margin-right: 0;
            line-height: 50px;
        }

        .nextStep {
            margin: 0 auto;
        }

        .layui-card .layui-card-body {
            font-size: 14px;
        }

        .layui-card .layui-card-body .layui-input {
            height: 35px;
            margin-bottom: 26px;
        }

        .layui-card .layui-card-body .layui-form-label {
            padding-left: 0;
            width: 120px;
        }
    </style>
</head>

<body>
    <div class="layui-fluid">
        <div class="layui-row layui-col-space15">
            <div class="layui-col-md12">
                <div class="layui-card" style="display: flex;justify-content: space-between;">
                    <div class="layui-card-body ">
                        <div class="title">
                            <div class="topstep1 pull-left active" style="margin-right:30px">
                                <span class="num">01</span>
                                <span>选择赛事类型</span>
                            </div>
                            <div class="pull-left" style="margin-right:30px">
                                <img src="../images/jiantou.jpg" alt="">
                            </div>
                            <div class="topstep2 pull-left">
                                <span class="num">02</span>
                                <span>编辑赛事基本信息</span>
                            </div>
                            <div style="clear: both;"></div>
                        </div>
                    </div>
                </div>
                <form class="layui-form" action="">
                    <div class="midstep1">
                        <div class="layui-card" style="display: flex;justify-content: space-between;">
                            <div class="layui-card-body" style="width: 100%;">
                                <div style="background: #EFEFEF;">选择赛事类型</div>
                                <div class="chooseType">
                                    <div class="layui-col-md12">
                                        <div class="layui-form-item layui-col-md8 layui-col-md-offset2">
                                            <div class="layui-col-md2" style="font-weight: 700;font-size:14px">对战人数：
                                            </div>
                                            <div class="layui-col-md10">
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="peopleNum" value="1" title="五人制足球赛">
                                                </div>
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="peopleNum" value="2" title="八人制足球赛">
                                                </div>
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="peopleNum" value="3" title="十一人制足球赛">
                                                </div>
                                                <!--                                            <div class="layui-col-md4">-->
                                                <!--                                                <input type="radio" name="peopleNum" value="4" title="鲁超联赛">-->
                                                <!--                                            </div>-->
                                                <!--                                            <div class="layui-col-md4">-->
                                                <!--                                                <input type="radio" name="peopleNum" value="5" title="省足协杯">-->
                                                <!--                                            </div>-->
                                                <!--                                            <div class="layui-col-md4">-->
                                                <!--                                                <input type="radio" name="peopleNum" value="6" title="其他类型">-->
                                                <!--                                            </div>-->
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-col-md12">
                                        <div class="layui-form-item layui-col-md8 layui-col-md-offset2">
                                            <div class="layui-col-md2" style="font-weight: 700;font-size:14px">
                                                山东省业余足球联赛：
                                            </div>
                                            <div class="layui-col-md10">
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="leagueMatch" value="1" title="超级">
                                                </div>
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="leagueMatch" value="2" title="甲级">
                                                </div>
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="leagueMatch" value="3" title="乙级">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="layui-col-md12">
                                        <div class="layui-form-item layui-col-md8 layui-col-md-offset2">
                                            <div class="layui-col-md2" style="font-weight: 700;font-size:14px">赛制规则：
                                            </div>
                                            <div class="layui-col-md10">
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="matchRule" value="1" title="循环制">
                                                </div>
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="matchRule" value="2" title="淘汰制">
                                                </div>
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="matchRule" value="3" title="混合制">
                                                </div>
                                                <!--                                            <div class="layui-col-md4">-->
                                                <!--                                                <input type="radio" name="matchRule" value="4" title="PAGE">-->
                                                <!--                                            </div>-->
                                                <div class="layui-col-md4">
                                                    <input type="radio" name="matchRule" value="4" title="单场比赛">
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                    <div style="text-align: center;">
                                        <button type="button" class="layui-btn layui-btn-normal nextStep">下一步</button>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="midstep2" style="display: none;">
                        <div class="layui-card" style="display: flex;justify-content: space-between;">
                            <div class="layui-card-body" style="width: 100%;">
                                <div style="background: #EFEFEF;margin-bottom: 15px;">编辑赛事基本信息</div>
                                <div class="layui-col-md12">
                                    <div class="layui-col-md8 layui-col-md-offset2">
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">赛事名称<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="saishi" placeholder="请输入赛事名称"
                                                    autocomplete="off" maxlength="10" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">主办方<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <select name="zhuban" id="s_zhuban" lay-filter="s_zhuban">
                                                    <option value="">请选择主办单位</option>                                                    
                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">主办方法人<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="organizersLegalPerson" readonly name="organizersLegalPerson" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">主办方注册资金：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="organizersRegisteredFund" readonly name="organizersRegisteredFund" placeholder="请输入主办方注册资金" autocomplete="off" class="layui-input">
                                            </div>
                                            <label class="layui-form-label" style="width: 45px;">万元</label>
                                        </div>
                                        <!-- 新增字段 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">业务范围：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="businessLine" readonly name="businessLine"autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">活动区域：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="movementArea" readonly name="movementArea"autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">联系人：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="linkman" readonly name="linkman"autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">固定电话：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="fixationTel" readonly name="fixationTel"autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">团体类型：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="groupType" readonly name="groupType"autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">保证金金额<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="depositSum" name="depositSum"autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">保证金缴纳时间<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="payTime" name="payTime"autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">支付方式<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <select name="payType" id="s_pay" lay-filter="s_pay">
                                                    <option value="">请选择支付方式</option>   
                                                    <option value="0">线下</option>
                                                    <option value="1">支付宝</option>
                                                    <option value="2">微信</option>                                                 
                                                </select>
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">退回方式<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <select name="refundType" id="s_payBack" lay-filter="s_payBack">
                                                    <option value="">请选择退回方式</option>      
                                                    <option value="0">线下</option>
                                                    <option value="1">支付宝</option>
                                                    <option value="2">微信</option>                                              
                                                </select>
                                            </div>
                                        </div>
                                        <!-- 结束新增字段 -->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">主办方类型<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" id="organizersType" readonly name="organizersType" placeholder="请输入主办方类型"
                                                    autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">承办单位<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="chengban" placeholder="请输入承办单位"
                                                    autocomplete="off" class="layui-input">
                                            </div>
                                            <span class="x-red">（单位间用“、”隔开）</span>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">协办单位<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="xieban" placeholder="请输入协办单位"
                                                    autocomplete="off" class="layui-input">
                                            </div>
                                            <span class="x-red">（单位间用“、”隔开）</span>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">球队招募数量<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="teamApplyNum" id="teamApplyNum"
                                                    placeholder="请输入球队招募数量" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">球队最大人数<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="teamApplyPeople" id="teamApplyPeople"
                                                    placeholder="请输入球队最大人数" autocomplete="off" class="layui-input">
                                            </div>
                                        </div>

                                        <!--                                    <div class="layui-form-item">-->
                                        <!--                                        <label class="layui-form-label">招募裁判人数<span class="x-red">*</span>：</label>-->
                                        <!--                                        <div class="layui-input-inline">-->
                                        <!--                                            <input type="number" name="recruitRedereeNum" placeholder="请输入招募裁判人数"-->
                                        <!--                                                   autocomplete="off" class="layui-input">-->
                                        <!--                                        </div>-->
                                        <!--                                    </div>-->
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">球队报名时间<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline" style="width: 178px;">
                                                <input type="text" name="qdbmsj1" id="qdbmsj1" placeholder="请选择开始时间"
                                                    autocomplete="off" class="layui-input">
                                            </div>
                                            <label class="layui-form-label" style="width: 20px;">至</label>
                                            <div class="layui-input-inline" style="width: 178px;">
                                                <input type="text" name="qdbmsj2" id="qdbmsj2" placeholder="请选择结束时间"
                                                    autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">赛事起止时间<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline" style="width: 178px;">
                                                <input type="text" name="ssqzsj1" id="ssqzsj1" placeholder="请选择开始时间"
                                                    autocomplete="off" class="layui-input">
                                            </div>
                                            <label class="layui-form-label" style="width: 20px;">至</label>
                                            <div class="layui-input-inline" style="width: 178px;">
                                                <input type="text" name="ssqzsj2" id="ssqzsj2" placeholder="请选择结束时间"
                                                    autocomplete="off" class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item">
                                            <label class="layui-form-label">主办地<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline" style="width: 120px;">
                                                <select name="country" id="s_province" lay-filter="s_province"></select>
                                            </div>
                                            <div class="layui-input-inline" style="width: 120px;">
                                                <select name="city" id="s_city" lay-filter="s_city"></select>
                                            </div>
                                            <label class="layui-form-label" style="width: 80px;">详细地址：</label>
                                            <div class="layui-input-inline" style="width: 246px;">
                                                <input type="text" name="xxdz" placeholder="请输入详细地址" autocomplete="off"
                                                    class="layui-input">
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-form-text">
                                            <label class="layui-form-label">比赛介绍<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline" style="width: 600px;">
                                                <textarea name="descripe" placeholder="请输入内容"
                                                    class="layui-textarea"></textarea>
                                            </div>
                                        </div>
                                        <div class="layui-form-item layui-form-text">
                                            <label class="layui-form-label">注意事项<span class="x-red">*</span>：</label>
                                            <div class="layui-input-inline" style="width: 600px;">
                                                <textarea name="notice" placeholder="请输入内容"
                                                    class="layui-textarea"></textarea>
                                            </div>
                                        </div>
                                        <div class="layui-form-item" style="margin-top: 40px;">
                                            <div class="layui-input-block" style="text-align: center;margin-left: 0;">
                                                <button type="reset" class="layui-btn layui-btn-primary" lay-submit
                                                    lay-filter="submit1">保存赛事
                                                </button>
                                                <button class="layui-btn" lay-submit lay-filter="submit2">发布赛事</button>
                                            </div>
                                        </div>
                                    </div>
                                </div>

                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</body>
<script>
    _init_area()
    layui.use(['table', 'laydate','form'], function () {
        var table = layui.table;
        var form = layui.form;
        var laydate = layui.laydate;

        var index = layer.load(1); //添加laoding,0-2两种方式
        layer.close(index)

        //执行一个laydate实例
        laydate.render({
            elem: '#qdbmsj1', //指定元素
            type: "datetime"
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#qdbmsj2', //指定元素
            type: "datetime"
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#ssqzsj1', //指定元素
            type: "datetime"
        });
        //执行一个laydate实例
        laydate.render({
            elem: '#ssqzsj2', //指定元素
            type: "datetime"
        });
        // 实例化保证金缴纳时间
        laydate.render({
            elem:'#payTime',
            type:'datetime'
        })

        form.render('select')

        // 获取主办方列表
        $.get(getRequestPrefix() + "/admin/localAssociation/getLocalAssociation", function (data) {
            if (data.msg) {
                parent.window.location.href = getRequestPrefix() + "/footBallAdmin/login.html"
            } else {
                if (data.data.length != 0) {
                    for (var i = 0; i < data.data.length; i++) {
                        $("#s_zhuban").append("<option value='" + data.data[i].id + "'>" + data.data[i].name + "</option>")
                    }
                    form.render("select");
                }
            }
        });

        // 根据选择的主办方id，带出主办方法人和注册资金信息
        form.on('select(s_zhuban)',function(data){
            $.ajax({
                url:zbfInfo,
                data:{
                    id:data.value
                },
                dataType: 'json',
                type: 'post',
                success: function (res) {
                    console.log(res,'输出查询的主办方信息')
                    if(res.data){
                        $('#organizersLegalPerson').val(res.data.legalRepresentative)
                        $('#organizersRegisteredFund').val(res.data.registeredFund)
                        $("#organizersType").val('各地足协')
                        $('#businessLine').val(res.data.businessLine)
                        $('#movementArea').val(res.data.movementArea)
                        $('#linkman').val(res.data.linkman)
                        $('#fixationTel').val(res.data.fixationTel)
                        if(res.data.groupType == 2){
                            $('#businessLine').val('俱乐部')
                        } else if(res.data.groupType == 3){
                            $('#businessLine').val('公司')
                        } else if(res.data.groupType == 4){
                            $('#businessLine').val('学校')
                        } else if(res.data.groupType == 5){
                            $('#businessLine').val('其他')
                        } else if(res.data.groupType == 6){
                            $('#businessLine').val('各地足协')
                        }
                        form.render('select')
                    } else {
                        $('#organizersLegalPerson').val('')
                        $('#organizersRegisteredFund').val('')
                        $("#organizersType").val('各地足协')
                        $('#businessLine').val('')
                        $('#movementArea').val('')
                        $('#linkman').val('')
                        $('#fixationTel').val('')
                        form.render('select')
                    }
                }
            })
        })

        $("#s_province").val("山东省")
        change(1);
        form.render('select');
        // 监听select改变，省市联动
        form.on('select(s_province)', function (data) {
            change(1);
            form.render('select');
        });
        $(".nextStep").on("click", function () {
            var peopleNum = $('input:radio[name="peopleNum"]:checked').val();
            var matchRule = $('input:radio[name="matchRule"]:checked').val();
            var leagueMatch = $('input:radio[name="leagueMatch"]:checked').val();
            if (peopleNum) {
                if (leagueMatch) {
                    if (matchRule) {
                        $(".topstep1").removeClass("active");
                        $(".topstep2").addClass("active");
                        $(".midstep1").css("display", "none")
                        $(".midstep2").css("display", "block")
                    } else {
                        layer.alert("请选择赛制规则")
                    }
                } else {
                    layer.alert("请选择山东省业余足球联赛")
                }

            } else {
                layer.alert("请选择对战人数")
            }
        })

        form.on('submit(submit1)', function (data) {
            var vsPerNum, rules, name, organizers, contractor, assistors, teamApplyStartTime,
                teamApplyEndTime, competitionStartTime, competitionEndTime, address, province, city,
                content, cautions, id, issueStatus, teamApplyNum, teamApplyPeople, leagueMatch,
                organizersLegalPerson, organizersRegisteredFund, organizersType,payTime,depositSum,payType,refundType;
            teamApplyNum = data.field.teamApplyNum;
            teamApplyPeople = data.field.teamApplyPeople;
            leagueMatch = data.field.leagueMatch
            vsPerNum = data.field.peopleNum;
            rules = data.field.matchRule;
            name = data.field.saishi;
            organizers = data.field.zhuban;
            contractor = data.field.chengban;
            assistors = data.field.xieban;
            teamApplyStartTime = data.field.qdbmsj1;
            teamApplyEndTime = data.field.qdbmsj2;
            competitionStartTime = data.field.ssqzsj1;
            competitionEndTime = data.field.ssqzsj2;
            address = data.field.xxdz;
            province = data.field.country;
            city = data.field.city;
            content = data.field.descripe;
            cautions = data.field.notice;
            organizersLegalPerson = data.field.organizersLegalPerson;
            organizersRegisteredFund = data.field.organizersRegisteredFund;
            organizersType = data.field.organizersType;
            payTime = data.field.payTime;//支付时间
            depositSum = data.field.depositSum;//保证金金额
            payType = data.field.payType;//支付方式
            refundType = data.field.refundType;//退回方式
            if (vsPerNum == "") {
                layer.alert("请选择对战人数", {
                    title: "提示"
                });
                return false
            } else if (rules == "") {
                layer.alert("请选择赛制规则", {
                    title: "提示"
                });
                return false
            } else if (name == "") {
                layer.alert("请输入赛事名称", {
                    title: "提示"
                });
                return false
            } else if (organizers == "") {
                layer.alert("请选择主办方", {
                    title: "提示"
                });
                return false
            } else if (organizersLegalPerson == "") {
                layer.alert("请输入主办方法人 ", {
                    title: "提示"
                });
                return false
            } else if (organizersRegisteredFund == "") {
                layer.alert("请输入主办方注册资金", {
                    title: "提示"
                });
                return false
            } else if (organizersType == "") {
                layer.alert("请输入主办方类型", {
                    title: "提示"
                });
                return false
            } else if (contractor == "") {
                layer.alert("请输入承办单位", {
                    title: "提示"
                });
                return false
            } else if (assistors == "") {
                layer.alert("请输入协办单位", {
                    title: "提示"
                });
                return false
            } else if (teamApplyNum == '') {
                layer.alert("请输入球队招募数量", {
                    title: "提示"
                });
                return false
            } else if (teamApplyPeople == '') {
                layer.alert("请输入球队最大人数", {
                    title: "提示"
                });
                return false
            } else if (teamApplyStartTime > teamApplyEndTime) {
                layer.alert("球队报名开始时间不能大于结束时间", {
                    title: "提示"
                });
                return false
            } else if (competitionStartTime == "" || competitionEndTime == "") {
                layer.alert("请选择赛事起止时间", {
                    title: "提示"
                });
                return false
            } else if (competitionStartTime > competitionEndTime) {
                layer.alert("赛事开始时间不能大于结束时间", {
                    title: "提示"
                });
                return false
            } else if (address == "") {
                layer.alert("请输入详细地址", {
                    title: "提示"
                });
                return false
            } else if (province == "省份") {
                layer.alert("请选择省份", {
                    title: "提示"
                });
                return false
            } else if (city == "地级市") {
                layer.alert("请选择地级市", {
                    title: "提示"
                });
                return false
            } else if (content == "") {
                layer.alert("请输入比赛介绍", {
                    title: "提示"
                });
                return false
            } else if (cautions == "") {
                layer.alert("请输入注意事项", {
                    title: "提示"
                });
                return false
            } else if(payTime == ''){
                layer.alert('请选择保证金缴纳时间',{
                    title:'提示'
                })
                return false
            } else if(depositSum == '') {
                layer.alert('请输入保证金金额',{
                    title:'提示'
                })
                return false
            } else if(refundType == ''){
                layer.alert('请选择退回方式',{
                    title:'提示'
                })
                return false
            } else if(payType == ''){
                layer.alert('请选择支付方式',{
                    title:'提示'
                })
                return false
            }
            $.ajax({
                url: addNewCompetition,
                data: {
                    vsPerNum: vsPerNum,
                    leagueMatch: leagueMatch,
                    rules: rules,
                    name: name,
                    organizers: organizers,
                    contractor: contractor,
                    assistors: assistors,
                    teamApplyStartTime: teamApplyStartTime,
                    teamApplyEndTime: teamApplyEndTime,
                    competitionStartTime: competitionStartTime,
                    competitionEndTime: competitionEndTime,
                    address: address,
                    province: province,
                    city: city,
                    content: content,
                    cautions: cautions,
                    issueStatus: 2,
                    teamApplyNum: teamApplyNum,
                    teamApplyPeople: teamApplyPeople,
                    organizersLegalPerson: organizersLegalPerson,
                    organizersRegisteredFund: organizersRegisteredFund,
                    organizersType: organizersType,
                    payType:payType,
                    payTime:payTime,
                    refundType:refundType,
                    depositSum:depositSum
                },
                dataType: 'json',
                type: 'post',
                success: function (res) {
                    if (res.msg == '0') {
                        layer.alert("操作成功", {
                            title: "提示",
                            cancel: function (index) {
                                parent.window.location.reload();
                                parent.layer.closeAll()
                            }
                        }, function (index) {
                            parent.window.location.reload();
                            parent.layer.closeAll()
                        });
                    } else {
                        layer.alert(res.msg)
                    }
                }
            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
        form.on('submit(submit2)', function (data) {
            var vsPerNum, rules, name, organizers, contractor, assistors, teamApplyStartTime,
                teamApplyEndTime, competitionStartTime, competitionEndTime, address, province, city,
                content, cautions, id, issueStatus, teamApplyNum, teamApplyPeople, leagueMatch,
                organizersLegalPerson, organizersRegisteredFund, organizersType,payTime,depositSum,payType,refundType;
            teamApplyNum = data.field.teamApplyNum;
            teamApplyPeople = data.field.teamApplyPeople;
            leagueMatch = data.field.leagueMatch
            vsPerNum = data.field.peopleNum;
            rules = data.field.matchRule;
            name = data.field.saishi;
            organizers = data.field.zhuban;
            contractor = data.field.chengban;
            assistors = data.field.xieban;
            teamApplyStartTime = data.field.qdbmsj1;
            teamApplyEndTime = data.field.qdbmsj2;
            competitionStartTime = data.field.ssqzsj1;
            competitionEndTime = data.field.ssqzsj2;
            address = data.field.xxdz;
            province = data.field.country;
            city = data.field.city;
            content = data.field.descripe;
            cautions = data.field.notice;
            organizersLegalPerson = data.field.organizersLegalPerson;
            organizersRegisteredFund = data.field.organizersRegisteredFund;
            organizersType = data.field.organizersType;
            payType = data.field.payType;
            refundType = data.field.refundType;
            payTime = data.field.payTime;//支付时间
            depositSum = data.field.depositSum;//保证金金额
            
            if (vsPerNum == "") {
                layer.alert("请选择对战人数", {
                    title: "提示"
                });
                return false
            } else if (rules == "") {
                layer.alert("请选择赛制规则", {
                    title: "提示"
                });
                return false
            } else if (name == "") {
                layer.alert("请输入赛事名称", {
                    title: "提示"
                });
                return false
            } else if (organizers == "") {
                layer.alert("请输入主办方", {
                    title: "提示"
                });
                return false
            } else if (organizersLegalPerson == "") {
                layer.alert("请输入主办方法人 ", {
                    title: "提示"
                });
                return false
            } else if (organizersRegisteredFund == "") {
                layer.alert("请输入主办方注册资金", {
                    title: "提示"
                });
                return false
            } else if (organizersType == "") {
                layer.alert("请输入主办方类型", {
                    title: "提示"
                });
                return false
            } else if (contractor == "") {
                layer.alert("请输入承办单位", {
                    title: "提示"
                });
                return false
            } else if (assistors == "") {
                layer.alert("请输入协办单位", {
                    title: "提示"
                });
                return false
            } else if (teamApplyNum == '') {
                layer.alert("请输入球队招募数量", {
                    title: "提示"
                });
                return false
            } else if (teamApplyPeople == '') {
                layer.alert("请输入球队最大人数", {
                    title: "提示"
                });
                return false
            } else if (teamApplyStartTime > teamApplyEndTime) {
                layer.alert("球队报名开始时间不能大于结束时间", {
                    title: "提示"
                });
                return false
            } else if (competitionStartTime == "" || competitionEndTime == "") {
                layer.alert("请选择赛事起止时间", {
                    title: "提示"
                });
                return false
            } else if (competitionStartTime > competitionEndTime) {
                layer.alert("赛事开始时间不能大于结束时间", {
                    title: "提示"
                });
                return false
            } else if (address == "") {
                layer.alert("请输入详细地址", {
                    title: "提示"
                });
                return false
            } else if (province == "省份") {
                layer.alert("请选择省份", {
                    title: "提示"
                });
                return false
            } else if (city == "地级市") {
                layer.alert("请选择地级市", {
                    title: "提示"
                });
                return false
            } else if (content == "") {
                layer.alert("请输入比赛介绍", {
                    title: "提示"
                });
                return false
            } else if (cautions == "") {
                layer.alert("请输入注意事项", {
                    title: "提示"
                });
                return false
            } else if(payTime == ''){
                layer.alert('请选择保证金缴纳时间',{
                    title:'提示'
                })
                return false
            } else if(depositSum == '') {
                layer.alert('请输入保证金金额',{
                    title:'提示'
                })
                return false
            } else if(refundType == ''){
                layer.alert('请选择退回方式',{
                    title:'提示'
                })
                return false
            } else if(payType == ''){
                layer.alert('请选择支付方式',{
                    title:'提示'
                })
                return false
            }
            $.ajax({
                url: addNewCompetition,
                data: {
                    vsPerNum: vsPerNum,
                    rules: rules,
                    leagueMatch: leagueMatch,
                    name: name,
                    organizers: organizers,
                    contractor: contractor,
                    assistors: assistors,
                    teamApplyStartTime: teamApplyStartTime,
                    teamApplyEndTime: teamApplyEndTime,
                    competitionStartTime: competitionStartTime,
                    competitionEndTime: competitionEndTime,
                    address: address,
                    province: province,
                    city: city,
                    content: content,
                    cautions: cautions,
                    issueStatus: 1,
                    teamApplyNum: teamApplyNum,
                    teamApplyPeople: teamApplyPeople,
                    organizersLegalPerson: organizersLegalPerson,
                    organizersRegisteredFund: organizersRegisteredFund,
                    organizersType: organizersType,
                    payTime:payTime,
                    depositSum:depositSum,
                    payType:payType,
                    refundType:refundType
                },
                dataType: 'json',
                type: 'post',
                success: function (res) {
                    if (res.msg == '0') {
                        layer.alert("操作成功", {
                            title: "提示",
                            cancel: function (index) {
                                parent.window.location.reload();
                                parent.layer.closeAll()
                            }
                        }, function (index) {
                            parent.window.location.reload();
                            parent.layer.closeAll()
                        });
                    } else {
                        layer.alert(res.msg)
                    }
                }
            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
        });
    })
</script>

</html>